import React, { useCallback } from "react";
import { Button } from "../../simple-ui/Button/index.jsx";
import { useRedux } from "../../hooks/useRedux";
import "./index.less";
const Index = () => {
  const { state, dispatch } = useRedux();
  const handleAddOnClick = useCallback(() => {
    dispatch &&
      dispatch({
        type: "add",
      });
  }, []);
  const handleMinusOnClick = useCallback(() => {
    dispatch &&
      dispatch({
        type: "minus",
      });
  }, []);

  return (
    <div>
      <div className="hello"></div>
      <Button onClick={handleMinusOnClick}>减一</Button>
      {state?.count}
      <Button onClick={handleAddOnClick}>加一</Button>
    </div>
  );
};

export default Index;
